<html>
<head><meta charset="utf-8"><title>CFG reducibility of MIR · t-compiler/help · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/index.html">t-compiler/help</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/CFG.20reducibility.20of.20MIR.html">CFG reducibility of MIR</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="213386431"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/CFG%20reducibility%20of%20MIR/near/213386431" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Ashley Hauck <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/CFG.20reducibility.20of.20MIR.html#213386431">(Oct 15 2020 at 07:04)</a>:</h4>
<p>Hi all! I'm wondering if <em>post-optimization</em> MIR is guaranteed to be reducible - specifically, the BBs output by rustc_codegen_ssa. If so, is there any guarantees it will continue to be going forwards? If not, do you know of an example that isn't?<br>
(I'm kind of surprised that I looked all over and couldn't find an answer to this anywhere, heh)</p>



<a name="213390967"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/CFG%20reducibility%20of%20MIR/near/213390967" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/CFG.20reducibility.20of.20MIR.html#213390967">(Oct 15 2020 at 08:01)</a>:</h4>
<p><span class="user-mention" data-user-id="330900">@Ashley Hauck</span> I don't think it is guaranteed anywhere. I only know that the successor of calls is guaranteed to only have a single predecessor. <a href="https://github.com/rust-lang/rust/blob/93deabce03dc10a80244f5da3e3819452744da2a/compiler/rustc_mir/src/transform/add_call_guards.rs">https://github.com/rust-lang/rust/blob/93deabce03dc10a80244f5da3e3819452744da2a/compiler/rustc_mir/src/transform/add_call_guards.rs</a> cg_llvm assumes so it can add the return value storage code to the destination block instead of creating a new block just for this. <a href="https://github.com/rust-lang/rust/issues/67161">#67161</a></p>



<a name="213391076"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/CFG%20reducibility%20of%20MIR/near/213391076" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/CFG.20reducibility.20of.20MIR.html#213391076">(Oct 15 2020 at 08:02)</a>:</h4>
<p>I can't think of any way the current mir optimizations could create an irreducible CFG. It could plausibly happen in the future though.</p>



<a name="213391553"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/CFG%20reducibility%20of%20MIR/near/213391553" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Ashley Hauck <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/CFG.20reducibility.20of.20MIR.html#213391553">(Oct 15 2020 at 08:07)</a>:</h4>
<p>okay, thanks so much!</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>